<?php
/**
 * 描述
 * Created by Paco
 * Date: 2019/1/29 Time: 15:19
 */

namespace App\Http\Request\Shop;


use App\Http\Request\Store;

class ShopStore extends Store
{
    public function rules()
    {
        $method = strtoupper($this->method());
        if ($method == 'POST') {
            return [
                'shop_name' => 'required|unique:shop,shop_name',
                'busniess_license' => 'required',
                'trademark' => 'required',
                'environment_protection' => 'required',
                'tel' => [
                    'required',
                    'regex:/^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\d{8}$|^0\d{2,3}-?\d{7,8}$/'],
                'company' => 'required',
                'contact' => 'required',
            ];
        } elseif ($method == 'PUT') {
            return [
                'shop_id' => 'required|integer',
            ];
        }
    }


    public function attributes()
    {
        return [
            'shop_name' => '店铺名称',
            'busniess_license' => '营业护照',
            'trademark' => '商标',
            'environment_protection' => '环保证',
            'moblie' => '手机',
            'company' => '公司名称',
            'contact' => '联系人',
        ];
    }
}